﻿<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../../../assets/docs.css" rel="stylesheet" type="text/css" media="screen" />
<title>MooTools Documentation - Class/Class.Occlude</title>
</head>

<body>
  <div class="doc">
    <div class="methods">
			<h4 class="menu-item"><a href="#Class-Occlude">Class.Occlude</a></h4>
			<div class="menu-item"><a href="#Class-Occlude:occlude">occlude</a></div>
			<div class="menu-item"><a href="#Class-Occlude:property">property</a></div>
    </div>
    <div class="l-border r-border span-15 content">
				<h1 id="Class-Occlude"><a href="#Class-Occlude">Class: Class.Occlude</a></h1>

<p class="description">Prevents a class from applying itself to an element that already has had the class applied.</p>

<h3>Tutorial/Demo</h3>

<ul>
<li><a href="http://www.clientcide.com/wiki/cnet-libraries/01.1-class.extras/03-occlude">Online Tutorial/Demo</a></li>
</ul>
<h2 id="Class-Occlude:occlude"><a href="#Class-Occlude:occlude">Class.Occlude Method: occlude</a></h2>

<p class="description">Determines if the class has already been applied to the element.</p>

<h3>Syntax</h3>

<pre class="javascript"><span class="kw1">this</span>.<span class="me1">occlude</span><span class="br0">(</span>property, element<span class="br0">)</span>
</pre>

<h3>Arguments</h3>

<ol>
<li>property - (<em>string</em>) property name for instances of this class attached to the element via <a href="../../core/Element/Element.html#Element:store">Element.Storage</a>
</li>
<li>element - (<em>mixed</em>) an Element or the string id of an Element to test</li>
</ol>
<h3>Example</h3>

<pre class="javascript"><span class="kw2">var</span> Widget = <span class="kw2">new</span> <span class="kw2">Class</span><span class="br0">(</span><span class="br0">{</span>
    Implements: <span class="br0">[</span><span class="kw2">Class</span>.<span class="me1">Occlude</span><span class="br0">]</span>,
    initialize: <span class="kw2">function</span><span class="br0">(</span>element<span class="br0">)</span><span class="br0">{</span>
        <span class="kw1">if</span> <span class="br0">(</span><span class="kw1">this</span>.<span class="me1">occlude</span><span class="br0">(</span><span class="st0">'widget'</span>, element<span class="br0">)</span><span class="br0">)</span> <span class="kw1">return</span> <span class="kw1">this</span>.<span class="me1">occluded</span>;
        <span class="co1">//returns the instance already bound to the element and exits</span>
    <span class="br0">}</span>
<span class="br0">}</span><span class="br0">)</span>;
</pre>

<h3>Note</h3>

<p>See the two properties below for ideal usage.</p>

<h2 id="Class-Occlude:property"><a href="#Class-Occlude:property">Class property: property</a></h2>

<p class="description">The string used to bind the instance of the class to the element.</p>

<h3>Example</h3>

<pre class="javascript"><span class="kw2">var</span> Widget = <span class="kw2">new</span> <span class="kw2">Class</span><span class="br0">(</span><span class="br0">{</span>
    Implements: <span class="br0">[</span><span class="kw2">Class</span>.<span class="me1">Occlude</span><span class="br0">]</span>,
    property: <span class="st0">'widget'</span>,
    initialize: <span class="kw2">function</span><span class="br0">(</span>element<span class="br0">)</span><span class="br0">{</span>
        <span class="kw1">this</span>.<span class="me1">element</span> = $<span class="br0">(</span>element<span class="br0">)</span>;
        <span class="kw1">if</span> <span class="br0">(</span><span class="kw1">this</span>.<span class="me1">occlude</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="kw1">return</span> <span class="kw1">this</span>.<span class="me1">occluded</span>;
        <span class="co1">//returns the instance already bound to the element and exits</span>
    <span class="br0">}</span>
<span class="br0">}</span><span class="br0">)</span>;
</pre>

<h3>Note</h3>

<p>In the example above, because we have a <em>this.element</em> property and because we define the <em>this.property</em> property in the class, the method <em>occlude</em> doesn't require any arguments as it uses these by default.</p>

    </div>
  </div>
<script type="text/javascript" src="../../../assets/mootools-core-1.3.js"></script>
<script type="text/javascript" src="../../../assets/mootools-more-smoothscroll.js"></script>
<script type="text/javascript" src="../../../assets/doc-assist.js"></script>
</body>
</html>
